<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org">
<head>
    <th:block th:include="include :: header('审批历史')"/>
</head>

<body class="gray-bg">
<div class="container-div">
    <div class="row">
        <div class="col-sm-12 search-collapse">
            <form id="role-form">
                <input id="instanceId" name="instanceId" th:value="${instanceId}" type="hidden">
                <div class="select-list">
                    <ul>
                        <li>
                            任务名称：<input name="activityName" type="text"/>
                        </li>
                        <li>
                            办理人ID：<input name="assignee" type="text"/>
                        </li>
                        <li>
                            <a class="btn btn-primary btn-rounded btn-sm" onclick="$.table.search()"><i
                                    class="fa fa-search"></i>&nbsp;搜索</a>
                            <a class="btn btn-warning btn-rounded btn-sm" onclick="$.form.reset()"><i
                                    class="fa fa-refresh"></i>&nbsp;重置</a>
                        </li>
                    </ul>
                </div>
            </form>
        </div>

        <div class="col-sm-12 select-table table-striped">
            <table id="bootstrap-table"></table>
        </div>
    </div>
</div>
<th:block th:include="include :: footer"/>
<script th:src="@{/js/activiti.js}"></script>
<script th:inline="javascript">
    var prefix = ctx + "process";

    $(function () {
        var options = {
            url: prefix + "/listHistory",
            queryParams: queryParams,
            sortName: "createTime",
            sortOrder: "desc",
            modalName: "审批历史",
            showSearch: false,
            showRefresh: false,
            showToggle: false,
            showColumns: false,
            clickToSelect: false,
            rememberSelected: false,
            pagination: false,
            columns: [{
                field: 'activityId',
                title: '活动ID',
                visible: false
            },
                {
                    field: 'activityName',
                    title: '任务名称'
                },
                {
                    field: 'assignee',
                    title: '处理人ID',
                    visible: true
                },
                {
                    field: 'assigneeName',
                    title: '处理人'
                },
                {
                    field: 'comment',
                    title: '审批意见'
                },
                {
                    field: 'startTime',
                    title: '开始时间'
                },
                {
                    field: 'endTime',
                    title: '结束时间'
                },
                {
                    field: 'durationInMillis',
                    title: '耗时',
                    formatter: function (value, row, index) {
                        if (!value) return '未知';
                        return formatTotalDateSub(value / 1000);
                    }
                }]
        };
        $.table.init(options);
    });

    function queryParams(params) {
        var search = $.table.queryParams(params);
        search.instanceId = $("#instanceId").val();
        return search;
    }

    /* 添加用户-选择用户-提交 */
    function submitHandler() {
        $.modal.close();
    }
</script>
</body>
</html>
